import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
	import gongyingshang from '@/views/modules/gongyingshang/list'
	import xiaoshoudingdan from '@/views/modules/xiaoshoudingdan/list'
	import shangpinxinxi from '@/views/modules/shangpinxinxi/list'
	import shangpinruku from '@/views/modules/shangpinruku/list'
	import kehuxinxi from '@/views/modules/kehuxinxi/list'
	import syslog from '@/views/modules/syslog/list'
	import kucunpandian from '@/views/modules/kucunpandian/list'
	import caigoudingdan from '@/views/modules/caigoudingdan/list'
	import yonghu from '@/views/modules/yonghu/list'
	import shangpinfenlei from '@/views/modules/shangpinfenlei/list'
	import shangpinchuku from '@/views/modules/shangpinchuku/list'
	import gonggaoxinxi from '@/views/modules/gonggaoxinxi/list'
	import cangkuxinxi from '@/views/modules/cangkuxinxi/list'


//2.配置路由   注意：名字
export const routes = [{
	path: '/',
	name: '系统首页',
	component: Index,
	children: [{
		// 这里不设置值，是把main作为默认页面
		path: '/',
		name: '系统首页',
		component: Home,
		meta: {icon:'', title:'center', affix: true}
	}, {
		path: '/updatePassword',
		name: '修改密码',
		component: UpdatePassword,
		meta: {icon:'', title:'updatePassword'}
	}, {
		path: '/pay',
		name: '支付',
		component: pay,
		meta: {icon:'', title:'pay'}
	}, {
		path: '/center',
		name: '个人信息',
		component: center,
		meta: {icon:'', title:'center'}
	}
	,{
		path: '/gongyingshang',
		name: '供应商',
		component: gongyingshang
	}
	,{
		path: '/xiaoshoudingdan',
		name: '销售订单',
		component: xiaoshoudingdan
	}
	,{
		path: '/shangpinxinxi',
		name: '商品信息',
		component: shangpinxinxi
	}
	,{
		path: '/shangpinruku',
		name: '商品入库',
		component: shangpinruku
	}
	,{
		path: '/kehuxinxi',
		name: '客户信息',
		component: kehuxinxi
	}
	,{
		path: '/syslog',
		name: '系统日志',
		component: syslog
	}
	,{
		path: '/kucunpandian',
		name: '库存盘点',
		component: kucunpandian
	}
	,{
		path: '/caigoudingdan',
		name: '采购订单',
		component: caigoudingdan
	}
	,{
		path: '/yonghu',
		name: '用户',
		component: yonghu
	}
	,{
		path: '/shangpinfenlei',
		name: '商品分类',
		component: shangpinfenlei
	}
	,{
		path: '/shangpinchuku',
		name: '商品出库',
		component: shangpinchuku
	}
	,{
		path: '/gonggaoxinxi',
		name: '公告信息',
		component: gonggaoxinxi
	}
	,{
		path: '/cangkuxinxi',
		name: '仓库信息',
		component: cangkuxinxi
	}
	]
	},
	{
		path: '/login',
		name: 'login',
		component: Login,
		meta: {icon:'', title:'login'}
	},
	{
		path: '/register',
		name: 'register',
		component: register,
		meta: {icon:'', title:'register'}
	},
	{
		path: '*',
		component: NotFound
	}
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
	mode: 'hash',
	/*hash模式改为history*/
	routes // （缩写）相当于 routes: routes
})
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}
export default router;
